﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Web.Http;
using System.Web.Http.Controllers;

namespace WMSNet.Core.Infrastructure.Api
{
    class AuthorizeApiAttribute : AuthorizeAttribute
    {
        public override void OnAuthorization(HttpActionContext actionContext)
        {
            BaseApiController baseApiController = actionContext.ControllerContext.Controller as BaseApiController;
            if (baseApiController != null && baseApiController.IsAuthenticated)
                return;
            actionContext.Response = new HttpResponseMessage(HttpStatusCode.Forbidden);
        }
    }

}
